ld grain 1.0
------------

-1.

  (C) Lauri Koponen 2002

  Big thanks to Ral Reales!

0. warnings

  THE SOUND IS VERY DEPENDENT ON SAMPLING RATE. CHANGING OUTPUT SAMPLING
  RATE *WILL* BREAK YOUR SONG!

  ... and don't set grain density too high, unless you have a fast cpu.

1. what is a grain?

  i'm not sure what is the exact definition of a sound grain but in
  this synth it's a short piece of audio data clipped from a wavetable
  wave. the piece is very short, usually less than 50ms. each grain
  has it's own envelope and can be replayed at any speed. a grain can
  also be extended in length, with it's contents looped. the wavetable
  wave position that is used as a grain data source can also be advanced
  at different speeds. also multiple grains can be played at the same
  time, but this will cause cpu usage to rise.



2. notes on parameters for the grain generator:


  inertia
     inertia does not affect all parameters.

  tuning1
     affects waveform playback speed.

  tuning2
     affects note pitch or waveform playback speed if notetarget is C.

  wave
     selects waveform index.

  glength
     grain length in samples.

  gdensity
     distance between grains, relative to glength.

  gdatalen
     length of grain data from wavetable in samples.

  gposstart
     position in wavetable where to start on note-on.

  gposdelta
     position advancement in wavetable for each grain in samples.

  gpitchmod
     pitch modulation during grain.

  gloopmode
     grain data loop mode. grain data (length set with gdatalength) is
     always looped, this parameter selects forward looping or ping-pong
     looping.

  wloop
     enable/disable sample looping.

  resetloop
     if 'on', sample position will be reset whenever a note-on occurs.

  gdenslen
     causes gdensity to modify glength too. if gdensity is 50%,
     also glength is scaled to 50%.

  notetarget
     selects different note handling mode. different modes allow sound
     pitch to be modified with note pitch in different situations.

  GEnvA/A[M]/D/D[M]/Mdl/Amnt
     modify grain envelope.
     grain envelope is a bezier curve. A controls envelope attack shape,
     D decay shape. A[M] and D[M] allow a bit more control on the shapes.
     Mdl is envelope middle position, 50% causes attack and decay length
     to be the same. Amnt changes envelope amount on grain volume.
     amount 0% = grain volume always at maximum, amount 100% = grain
     volume completely controlled by envelope (beginning and end at zero,
     middle at maximum).


3. notes on parameters for the grain effect:

  the parameters are the same as in the grain generator, except for a few
  missing parameters only useful for samples. the latest received input
  sound will be used as grain material.

4. extras

  there's a built-in dc filter, enable it in the attributes. it's not
  very good, though.

 - ld0d@kolumbus.fi
